package com.tang.h2_demo.service.impl;

import com.tang.h2_demo.dao.UserInfDao;
import com.tang.h2_demo.domain.UserInf;
import com.tang.h2_demo.service.UserInfService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author tangyuan2meicloud.com
 * @DATE 2021/12/23 20:48
 * @Desc
 * @Remarks
 */
@Service
public class UserInfServiceImpl implements UserInfService {
    @Autowired
    private UserInfDao userInfDao;


    @Transactional(rollbackFor = Exception.class)
    @Override
    public void save(UserInf user) {
        userInfDao.save(user);
        throw new RuntimeException("我太坏了！！");
    }

    @Override
    public void delete(UserInf user) {
        userInfDao.delete(user);
    }

    @Override
    public List<UserInf> findAll() {
        return userInfDao.findAll();
    }
}
